package com.youdianstar.app.ui.help

import androidx.lifecycle.viewModelScope
import com.youdianstar.app.entity.FaqQuestionItem
import com.youdianstar.app.support.ApiRepository
import com.youdianstar.app.common.base.BaseViewModel
import com.youdianstar.app.common.event.NetStateLiveData
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch


/**
 * File: FaqViewModel
 * Author: 82149 Create: 2021/11/30 16:12
 * Changes (from 2021/11/30)
 * --------------------------------------------------
 * description:
 * ---------------------------------------------------
 *
 */
class FaqViewModel(private val repo: ApiRepository) : BaseViewModel(){

    val faqListLiveData = NetStateLiveData<List<FaqQuestionItem>>()
    
    /**
     * 测试新接口V2，用于查看返回格式
     */
    val faqListV2LiveData = NetStateLiveData<Any>()

    fun getFaqList(){
        viewModelScope.launch(Dispatchers.IO) {
            repo.getFaqList(faqListLiveData)
        }
    }
    
    /**
     * 调用新接口V2查看返回格式
     */
    fun getFaqListV2(){
        viewModelScope.launch(Dispatchers.IO) {
            repo.getFaqListV2(faqListV2LiveData)
        }
    }

}